<?php
/**
 * The Template for displaying all single posts.
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */

    get_header(); ?>

	<div id="primary" class="site-content">
            <div id="content-single" role="main">
                <?php while ( have_posts() ) : the_post(); ?>
                <?php
                $post_metas=hd_get_post_data(get_the_ID());
                $cat=get_the_category();
                $volver_a_id=17;
                $volver_a_texto="LOGRAEXITOS";
                if($cat[0]->term_id==11){
                    $volver_a_id=18;
                    $volver_a_texto="COACH PERSONAL";
                }
                ?>
                <article id="post-<?php the_ID(); ?>" <?php post_class($post_metas['destacado_home_formato']); ?>>
                    <header class="entry-header">
                        <a href="<?php echo get_permalink($volver_a_id);?>">&lt;&lt; VOLVER A <?php echo $volver_a_texto;?></a>
                    </header><!-- .entry-header -->
                    <div class="entry-summary">
                        <div class="entry-thumbnail">
                            <?php the_post_thumbnail('full');?>
                        </div>
                        <div class="entry-title">
                            <h1><?php the_title(); ?></h1>
                            <h4><?php echo $post_metas['the_sub_subtitle'];?></h4>
                            <p><?php echo strip_tags(get_the_excerpt()); ?></p>
                            <div class="separador"></div>
                            <div class="extras">
                                <div class="horarios">
                                    <h1>HORARIO</h1>
                                    <?php echo $post_metas['destacado_home_horarios'];?>
                                </div>
                                <div class="localizacion">
                                    <h1>LOCALIZACION</h1>
                                    <?php echo $post_metas['destacado_home_partcipantes'];?>
                                </div>
                                <div class="participantes">
                                    <h1>PARTICIPANTES</h1>
                                    <?php echo $post_metas['destacado_home_localizacion'];?>
                                </div>
                            </div>
                            <div class="separador"></div>
                        </div>
                    </div>
                    <div style="clear:both;"></div>
                    <div class="entry-content">
                            <?php the_content(); ?>
                    </div><!-- .entry-content -->
                    <div style="clear:both;"></div>
                </article><!-- #post -->
                <?php endwhile; // end of the loop. ?>
                <div id="pie-single"></div>
                
                <div id="medio">
                    <?php
                    $imgArr=wp_get_attachment_image_src(200, "full");
                    ?>
                    <img src="<?php echo $imgArr[0];?>" width="<?php echo $imgArr[1];?>" height="<?php echo $imgArr[2];?>" />
                </div>
                
                <div id="abajo">
                    <?php 
                    $args="posts_per_page=6&category_name=".$cat[0]->slug;
                    $the_query = new WP_Query( $args );
                    $i=0;
                    while ( $the_query->have_posts() ) {
                            $the_query->the_post();
                            hd_content_print(get_the_ID(), $i);
                            $i=($i<=3)?$i+1:0;
                    }
                    ?>
                </div>
            </div><!-- #content -->
	</div><!-- #primary -->
<?php get_footer(); ?>